{% extends "ErpBundle::layout.html.twig" %}
{% block title %}{{ parent() }} - Afficher Sondage{% endblock %}
{% block body %}
Afficher un Sondage<br /><br>

{% if yourVote[0]['id'] is defined %}
	{% for q in questionName %}
		<h3>Objet du sondage : {{q.ques}}</h3>
	{% endfor %}
	{% for d in differentVotes %}
		<div class="option" ><p>
			<div class="option" ><p>{{ d.value }}(<em><?php round(?> {{d.votes*100/countVotes[0]['totalvotes']}}<?php ) ?>%, {{d.votes}} votes</em>)</p>
			<div class="bar 
			{% if yourVote[0]['id'] == d.id %}
				yourvote
			{% endif %}
			" style= "width:{{d.votes*100/countVotes[0]['totalvotes']}}%" ></div></div>
			
	{% endfor %}
	<p><strong>Total Votes: {{countVotes[0]['totalvotes']}}</strong></p>
{% else %}
	{% for qu in questionName %}
	<form method="post" action="../submit_sondage" > 
		<h3>{{qu.ques}}</h3>
		<table style="margin-left : 70px;"><tr><td>
		<input type="hidden" class="idSondage" name="_id" value="{{qu.id}}" /> </td></tr>  
	{% endfor %}
	{% for q in questions %}
		   	<tr><td>{{q.value}}</td><td><input type="radio" name="choix" value="{{q.id}}"></td>
	{% endfor %}
		<tr><td><input type="submit" value="R&eacute;pondre" /></td></tr>
		</table>
	</form>
	<br />
{% endif %}		
<a href="{{ asset('app_dev.php/erp/afficher_sondage') }}">Retour</a>

{% endblock %}